$(document).ready(function() {
	
	jQuery("#fechaFinalizacion").datepicker({
		minDate : +0,
        changeMonth: true,
        changeYear: true
    });
	jQuery("#fechaFinalizacion").datepicker( "option", "dateFormat", "dd/mm/yy");
	if (document.getElementById("fechaHidden")){
		jQuery("#fechaFinalizacion").val(document.getElementById("fechaHidden").value);
	}
	
	
	 tinyMCE.init({
	        mode: "textareas",
	        theme: "advanced",
	        language : "en",
	        plugins : "autolink,lists,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen, preview,noneditable,visualchars,nonbreaking,template,wordcount,advlist, media",
	        theme_advanced_buttons1 : "fontselect, fontsizeselect,|,forecolor,backcolor,|,bold,italic,underline",
		    theme_advanced_buttons2 : "cut,copy,paste,|,bullist,numlist,|,newdocument,undo,redo,|,fullscreen, preview,|, image, media, |, justifyleft, justifycenter, justifyright, justifyfull",
		    theme_advanced_buttons3 : "",      
		    theme_advanced_toolbar_location : "top",
		    theme_advanced_toolbar_align : "left",
		    theme_advanced_statusbar_location : "bottom",
		    theme_advanced_resizing : false
	});
	
//	$('.fechaFinalizacion').datepicker();
//	 jQuery("#fechaFinalizacion").datepicker({
//			format: 'dd/mm/yyyy'
//		});
//	 jQuery("#fechaFinalizacion").datepicker().on('changeDate', function(ev){jQuery("#fechaFinalizacion").datepicker('hide');});
//	 jQuery("#fechaFinalizacion").datepicker().on('click', function(ev){jQuery("#fechaFinalizacion").datepicker('show');});
//	 jQuery("#fechaFinalizacion").datepicker( "option", "dateFormat", "dd/mm/yyyy");
//	 if (document.getElementById("fechaHidden")){
//		 jQuery("#fechaFinalizacion").val(document.getElementById("fechaHidden").value);
//	}
});


function muestraLimiteParticipantes(initial){
	if(jQuery("#tieneLimiteParticipantes") && jQuery("#tieneLimiteParticipantes").is(':checked')){
		jQuery("#MinimoYMaximo").show();
		if (!initial){
			jQuery("#minimoParticipantes").val("");
			jQuery("#maximoParticipantes").val("");
		}
		jQuery("#minimoParticipantes").focus();
	}else{
		jQuery("#MinimoYMaximo").hide();
	}
}